home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.cyberramp.net!news
- From: sinan@cyberramp.net (John Noland)
- Newsgroups: comp.lang.c
- Subject: Re: Beginer C please help me
- Date: 21 Mar 1996 20:42:17 GMT
- Organization: Prose Software
- Message-ID: <4isev9$a44@newshost.cyberramp.net>
- References: <DoLCFx.B7x.0.bloor@torfree.net>
- NNTP-Posting-Host: ramp1-21.cyberramp.net
- X-Newsreader: WinVN 0.99.5
-
- In article <DoLCFx.B7x.0.bloor@torfree.net>, bz786@torfree.net says...
-
- > I have complied and run the programme & I got the answer n=1.000
- > but I am supposed to get answer 1.8.
-
- In your statement n=(9/5);, you're dividing an integer by an integer giving
- you a rounded integer as a result. Try, n = 9.0/5.0; instead. This ensures
- that any intermediate values used by your compiler are of the proper type.
-
- -John
-
-